<%-- 
    Document   : checkoutin
    Created on : Feb 8, 2012, 11:37:52 PM
    Author     : Anthony Ferrari
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Active Reservations</title>
        <jsp:include page="headers.jsp" />
    </head>
    <body>
        <div id="main_container">
            <jsp:include page="loginheader.jsp"/>
            <div class="main_content">
                <jsp:include page="${sessionScope.menuChoice}" /> <!-- include home menu -->
                <div class="center_content">
                    <div class="left_content">

                    </div> <!-- end left content -->
                    <div class="right_content">
                        <h2>Active Reservations</h2>
                        <table id="myTable" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
                            <thead>
                                <tr style="font-weight: bold">
                                    <th class="rounded-right" align="center">Check Out/In</th>
                                    <th class="rounded-left" align="center">Item</th>
                                    <th class="rounded" align="center">Model</th>
                                    <th class="rounded" align="center">Instructor</th>
                                    <th class="rounded" align="center">Start Date</th>
                                    <th class="rounded" align="center">End Date</th>
                                    <th class="rounded" align="center">Start Time</th>
                                    <th class="rounded" align="center">End Time</th>
                                </tr>
                            </thead>
                            <tbody>
                                <c:forEach var="reservation" items="${reservations}">
                                    <tr>
                                        <c:choose>
                                            <c:when test="${reservation.reservationState =='inProgress'}">
                                                <td align="center"> <a href="CheckOutIn?reservationID=${reservation.id}&button=checkin"><button>Check In</button></a></td>
                                            </c:when>
                                            <c:otherwise>
                                                <td align="center"> <a href="CheckOutIn?reservationID=${reservation.id}&button=checkout"><button>Check Out</button></a></td>
                                            </c:otherwise>
                                        </c:choose>
                                        <td>${reservation.discriminator}</td>
                                        <td>${reservation.rentalItem.aircraftType}</td>
                                        <td>${reservation.pilot.firstName} ${reservation.pilot.lastName}</td>
                                        <td><fmt:formatDate type="date"  pattern="MMM-dd-yyyy" value="${reservation.startDate}" /></td>
                                        <td><fmt:formatDate type="date"  pattern="MMM-dd-yyyy" value="${reservation.endDate}" /></td>
                                        <td><fmt:formatDate type="time" value="${reservation.startTime}" /></td>
                                        <td><fmt:formatDate type="time" value="${reservation.endTime}" /></td>
                                    </tr>
                                </c:forEach>
                            </tbody>
                        </table>
                    </div> <!-- end of right content -->
                </div>   <!--end of center content -->
                <div class="clear"></div>
            </div> <!--end of main content-->
            <div class="footer">
                <div class="left_footer"><a href="RedTeam">Powered by: Red Team</a><a href="http://apycom.com/"></a></div>
                <div class="right_footer"></div>
            </div> <!-- end footer -->
        </div> <!-- end main container -->
    </body>
</html>
